package dao;

import bean.XuanKe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

public class XuanKeDaoImpl implements IXuanKeDao {
    @Autowired
    JdbcTemplate jdbcTemplate;


    @Override
    public XuanKe xuanke(String number) {
        return null;
    }

    @Override
    public XuanKe getXuanKe(String Number) {
        String sql = "select * from xuanke where number = ?";
        XuanKe xuanke = jdbcTemplate.queryForObject(sql, new BeanPropertyRowMapper<XuanKe>(XuanKe.class), Number);
        return xuanke;
    }

    @Override
    public int updateXuanke(String number, Integer moive) {
        String sql = "update xuanke set moive = ? where number = ?";
        int update = jdbcTemplate.update(sql, moive, number);
        return update;
    }
}